package com.fwj.core.common.common;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author: fwj
 * @Data: 2021/12/19 12:42
 * @Version 1.0
 * @Description:
 */

public class MinuteCounter {
    private static final int MASK = 0x7FFFFFFF;
    private final AtomicInteger atom;

    public MinuteCounter() {
        atom = new AtomicInteger(0);
    }

    public final int incrementAndGet() {
        return atom.incrementAndGet() & MASK;
    }

    public int get() {
        return atom.get() & MASK;
    }

    public void set(int newValue) {
        atom.set(newValue & MASK);
    }
}
